var express = require('express');
var path = require('path');
var router = express.Router();
const multer = require('multer')


var userController = require(path.join(process.cwd(),"/controller/userController"));
var searchController = require(path.join(process.cwd(),"/controller/searchController"));

//注册接口
router.post('/regist', userController.register)

//登录接口
router.post('/login', userController.useridLogin)

//发送短信验证
router.post('/sendCoreCode', userController.sendCoreCode)

//短信验证登录
router.post('/codePhoneLogin', userController.codePhoneLogin)

//更新用户基本信息
router.put('/updateuser/:userid', userController.updateUser)

// //添加一个用户粉丝
// router.post('/adduserfans/:userid', userController.addUserFans)

//添加用户一个关注
router.post('/adduserfollow/:userid',userController.addUserFollow)

//用户发布了一个视频
router.post('/adduservideo/:userid',multer({
  dest:'uploads/video'
}).array('file',9),userController.addUserVideo)

//用户把视频加入了喜欢
router.post('/adduserlikevideo/:userid', userController.addUserlikeVideo)

//用户取消了关注
router.delete('/removeuserfollow/:userid', userController.removeUserFollow)

//用户取消了喜欢
router.delete('/removeuserlikevideo/:userid', userController.removeUserLikeVideo)

//用户删除了自己发布的视频
router.delete('/removeUserSelfVideo/:userid', userController.removeUserSelfVideo)

//获取某个用户喜欢的视频
router.get('/getuserlikevideo/:userid', userController.getUserLikeVideo)

//获取某个用户自己的视频
router.get('/getuserselfvideo/:userid', userController.getUserSelfVideo)

//获取用户基本信息
router.get('/getuserinfo/:userid',userController.getUserInfo)

//获取用户粉丝列表
router.get('/getuserfans/:userid',userController.getUserFans)

//获取用户的关注列表
router.get('/getuserfollow/:userid',userController.getUserFollow)

//更新用户头像
router.patch('/updateuserphoto/:userid',multer({
  dest:'uploads/image'
}).single('file'),userController.updateUserPhoto)

//更新用户基本资料
router.put('/updateuserinfo/:userid',userController.updateUserInfo)

//更新用户喜欢视频的类型的
router.put('/updateuserlikestyle/:userid',userController.updateUserLikeStyle)

//用户评论一条
router.post('/createcomment/:userid',userController.createComment)

//用户点赞一条
router.post('/onlikecomment/:userid',userController.onLikeComment)

//用户点赞取消
router.post('/removeuserlikecomment/:userid',userController.removeUserLikeComment)

//用户删除了评论
router.delete('/removeusercomment/:userid',userController.removeUserComment)

//获取推荐列表
router.get('/getrecommentvideo',userController.getRecommentVideo)

//获取用户的搜索
router.get('/getusersearch/:key',searchController.getUserSearch)

//获取用户的关注人的视频
router.get('/getuserfocusvideo',userController.getUserFocusVideo)

//发送一条评论
router.post('/createmessage/:userid',userController.createMessage)

//获取用户消息列表
router.get('/getusermessage/:userid',userController.getUserMessage)

//获取删除了消息
router.delete('/removeusermessage/:userid',userController.removeUserMessage)


//获取对话消息
router.get('/getonemessage/:userid',userController.getOneMessage)
module.exports = router;
